home *** CD-ROM | disk | FTP | other *** search
/ isnet Internet / Isnet Internet CD.iso / prog / chat / 12 / 12.exe / SYSTEM / userlist.als < prev    next >
Encoding:
Text File  |  1999-09-07  |  12.1 KB  |  390 lines

  1. uwhois {
  2.   if ($1 == $null) {
  3.     iecho Syntax: /uwhois <user> [command]
  4.     return
  5.   }
  6.   if ($2) set %uwhois.cmd $2-
  7.   else set %uwhois.cmd iiecho
  8.   if ($usrhost($1) == $null) {
  9.     if ($usr($1)) iecho Can't find $hc($1) on userlist, try $hc($usr($1)) instead.
  10.     else iecho Can't find $hc($1) on userlist.
  11.     return
  12.   }
  13.   if ($readini users.ini $1 password != $null) set %uwhois.pass yes
  14.   else set %uwhois.pass no
  15.   if ($readini users.ini $1 botpass != $null) set %uwhois.bpass yes
  16.   else set %uwhois.bpass no
  17.   if (0) set %uwhois.notes 0
  18.   else set %uwhois.notes N/A
  19.   set %uwhois.seen $readini -n users.ini $1 seen
  20.   :begin
  21.   %uwhois.cmd $fix(9,HANDLE) PASS BOTPASS NOTES $fix(17,FLAGS) LAST
  22.   %uwhois.cmd $fix(9,$1) $fix(4,%uwhois.pass) $fix(7,%uwhois.bpass) $fix(5,%uwhois.notes) $fix(17,$flags($1)) $iif(%uwhois.seen,$asctime($gettok(%uwhois.seen,1,32),h:nntt),never)
  23.   set %uwhois.i 0
  24.   :flags
  25.   inc %uwhois.i
  26.   if ($gettok($usrchans($1),%uwhois.i,44)) {
  27.     %uwhois.cmd   $fix(26,$gettok($usrchans($1),%uwhois.i,44)) $cflags($1,$gettok($usrchans($1),%uwhois.i,44))
  28.     if ($infoline($1,$gettok($usrchans($1),%uwhois.i,44))) %uwhois.cmd  #INFO: $infoline($1,$gettok($usrchans($1),%uwhois.i,44))
  29.     goto flags
  30.   }
  31.   set %uwhois.i 0
  32.   :start
  33.   inc %uwhois.i
  34.   set %uwhois.host $hstmask($1,%uwhois.i)
  35.   if (%uwhois.host != $null) {
  36.     if (%uwhois.i == 1) %uwhois.cmd $lfix(8,HOSTS:) %uwhois.host
  37.     else %uwhois.cmd $fix(8,) %uwhois.host
  38.     goto start
  39.   }
  40.   if ($infoline($1)) %uwhois.cmd $lfix(7,INFO:) $infoline($1)
  41.   unset %uwhois.*
  42. }
  43. adduser {
  44.   if ($1 == $null) {
  45.     iecho Syntax: /adduser <username> [hostmask] [nickname] [pass]
  46.     return
  47.   }
  48.   if ($1 == Users) {
  49.     iecho Invalid username.
  50.     return
  51.   }
  52.   if ($usrhost($1)) {
  53.     iecho Error! User $hc($1) already exists!
  54.     return
  55.   }
  56.   if ($2) set %adduser.addr $2
  57.   elseif ($address($1,3)) set %adduser.addr $address($1,3)
  58.   else {
  59.     iecho No hostmask supplied and user is not online!
  60.     return
  61.   }
  62.   if ($readini -n users.ini users %adduser.addr != $null) {
  63.     iecho Error! Someone is already using that hostmask!
  64.     return
  65.   }
  66.   .auser 40 %adduser.addr
  67.   .save -ru users.mrc
  68.   writeini -n users.ini Users %adduser.addr $1
  69.   writeini -n users.ini $1 hostmask %adduser.addr
  70.   writeini -n users.ini $1 flags -
  71.   if ($3) {
  72.     qnotice $3 You have been added to my userlist.
  73.     qnotice $3 Type /ctcp $me HELP for command info
  74.   }
  75.   if ($4) {
  76.     crypt 0 $lower($1) $4
  77.     writeini -n users.ini $1 password $result
  78.     qnotice $3 Your password has been set to ' $+ $4 $+ '
  79.   }
  80.   elseif ($3) qnotice $3 You have no password set, please set one.
  81.   colupdt3 %adduser.addr
  82.   if ($show) iecho Added $hc($1) with hostmask $sc(%adduser.addr) $+ .
  83.   unset %adduser.*
  84. }
  85. addbot {
  86.   if ($1 == $null) {
  87.     iecho Syntax: /addbot <username> [hostmask] [pass]
  88.     return
  89.   }
  90.   if ($1 == Users) {
  91.     iecho Invalid username.
  92.     return
  93.   }
  94.   if ($usrhost($1)) {
  95.     iecho Error! User $hc($1) already exists!
  96.     return
  97.   }
  98.   if ($2) set %adduser.addr $2
  99.   elseif ($address($1,1)) set %adduser.addr $address($1,1)
  100.   else {
  101.     iecho No hostmask supplied and user is not online!
  102.     return
  103.   }
  104.   if ($readini -n users.ini users %adduser.addr != $null) {
  105.     iecho Error! Someone is already using that hostmask!
  106.     return
  107.   }
  108.   .auser 40 %adduser.addr
  109.   .save -ru users.mrc
  110.   writeini -n users.ini Users %adduser.addr $1
  111.   writeini -n users.ini $1 hostmask %adduser.addr
  112.   writeini -n users.ini $1 flags b
  113.   if ($3) {
  114.     crypt 0 $lower($1) $3
  115.     writeini -n users.ini $1 botpass $result
  116.   }
  117.   colupdt3 %adduser.addr
  118.   if ($show) iecho Added bot $hc($1) with hostmask $sc(%adduser.addr) $+ .
  119.   unset %adduser.*
  120. }
  121. chattr {
  122.   if ($1 == $null) {
  123.     iecho Syntax: /chattr <username> [[+|-]flags [channel]]
  124.     return
  125.   }
  126.   elseif ($usrhost($1) == $null) {
  127.     if ($usr($1)) iecho Can't find $hc($1) on userlist, try $hc($usr($1)) instead.
  128.     else iecho Can't find $hc($1) on userlist.
  129.     return
  130.   }
  131.   if ($3) {
  132.     if ($findtok($usrchans($1),$3,1,44) == $null) addchan $1 $3
  133.     set %tmp.chattr $cflags($1,$3)
  134.   }
  135.   else set %tmp.chattr $flags($1)
  136.   if ((+ isin $2) || (- isin $2)) {
  137.     set %i.chattr 0
  138.     unset %j.chattr
  139.     :start
  140.     inc %i.chattr
  141.     if ($mid($2,%i.chattr,1) != $null) {
  142.       if ($mid($2,%i.chattr,1) == +) set %j.chattr +
  143.       elseif ($mid($2,%i.chattr,1) == -) set %j.chattr -
  144.       else {
  145.         if (%j.chattr == +) set %tmp.chattr - $+ $removecs(%tmp.chattr,$mid($2,%i.chattr,1),-) $+ $mid($2,%i.chattr,1)
  146.         elseif (%j.chattr == -) set %tmp.chattr - $+ $removecs(%tmp.chattr,$mid($2,%i.chattr,1),-)
  147.       }
  148.       goto start
  149.     }
  150.   }
  151.   else set %tmp.chattr $2
  152.   if ($3) {
  153.     if ($remove(%tmp.chattr,-) != $null) {
  154.       writeini -n users.ini $1 $3 $remove(%tmp.chattr,-)
  155.       colupdt2 $1
  156.       if ($show) iecho Channel flags for $hc($1) in $sc($3) are now $hc($remove(%tmp.chattr,-))
  157.       return
  158.     }
  159.     writeini -n users.ini $1 $3 -
  160.     colupdt2 $1
  161.     if ($show) iecho Removed flags for $hc($1) in $sc($3)
  162.   }
  163.   elseif ($2) {
  164.     if ($remove(%tmp.chattr,-) != $null) {
  165.       writeini -n users.ini $1 flags $remove(%tmp.chattr,-)
  166.       colupdt2 $1
  167.       if ($show) iecho Global flags for $hc($1) are now $hc($remove(%tmp.chattr,-))
  168.       return
  169.     }
  170.     writeini -n users.ini $1 flags -
  171.     colupdt2 $1
  172.     if ($show) iecho Removed global flags for $hc($1)
  173.   }
  174.   elseif ($3) {
  175.     if ($flags($1) != -) iecho Global flags for $hc($1) are $hc($flags($1))
  176.     else iecho $hc($1) has no global flags
  177.   }
  178. }
  179. addchan {
  180.   if ($2 == $null) iecho Syntax: /addchan <username> <#channel>
  181.   elseif ($usrhost($1) == $null) iecho Can't find $hc($1) on userlist.
  182.   elseif ($findtok($usrchans($1),$2,1,44)) iecho Channel record already exists!
  183.   else {
  184.     writeini -n users.ini $1 channels $addtok($usrchans($1),$2,44)
  185.     writeini -n users.ini $1 $2 -
  186.     if ($show) iecho Added channel $sc($2) to $hc($1)
  187.   }
  188. }
  189. remchan {
  190.   if ($2 == $null) iecho Syntax: /remchan <username> <#channel>
  191.   elseif ($usrhost($1) == $null) iecho Can't find $hc($1) on userlist.
  192.   elseif ($findtok($usrchans($1),$2,1,44) == $null) iecho $sc($2) not in channels for $hc($1)
  193.   else {
  194.     if ($usrchans($1) == $2) remini users.ini $1 channels
  195.     else writeini -n users.ini $1 channels $remtok($usrchans($1),$2,1,44)
  196.     remini users.ini $1 $2
  197.     remini users.ini $1 infoline. [ $+ [ $2 ] ]
  198.     if ($show) {
  199.       iecho Removed channel $sc($2) from $hc($1)
  200.       iecho This includes any info-line set for that channel.
  201.     }
  202.   }
  203. }
  204. remuser {
  205.   if ($1 == $null) {
  206.     iecho Syntax: /remuser <user>
  207.     return
  208.   }
  209.   elseif ($usrhost($1) == $null) {
  210.     iecho Error! No such user $hc($1)
  211.     return
  212.   }
  213.   set %i.remuser 0
  214.   :start
  215.   inc %i.remuser
  216.   if ($hstmask($1,%i.remuser)) {
  217.     .ruser 40 $hstmask($1,%i.remuser)
  218.     .timer 1 0 colupdt3 $hstmask($1,%i.remuser)
  219.     remini users.ini Users $hstmask($1,%i.remuser)
  220.     goto start
  221.   }
  222.   remini users.ini $1
  223.   if ($show) iecho Removed user entry for $hc($1)
  224. }
  225. chpass {
  226.   if ($1 == $null) {
  227.     iecho Syntax: /chpass <user> [password]
  228.     return
  229.   }
  230.   elseif ($usrhost($1) == $null) {
  231.     if ($usr($1)) iecho Can't find $hc($1) on userlist, try $hc($usr($1)) instead.
  232.     else iecho Can't find $hc($1) on userlist.
  233.     return
  234.   }
  235.   if ($len($2) > 3) {
  236.     crypt 0 $lower($1) $2
  237.     writeini -n users.ini $1 password $result
  238.     if ($show) iecho Changed password for $hc($1)
  239.   }
  240.   elseif ($2) iecho Password too short! Use at least 4 characters.
  241.   else {
  242.     remini users.ini $1 password
  243.     if ($show) iecho Removed password for $hc($1)
  244.   }
  245. }
  246. chbotpass {
  247.   if ($1 == $null) {
  248.     iecho Syntax: /chbotpass <user> [password]
  249.     return
  250.   }
  251.   elseif ($usrhost($1) == $null) {
  252.     if ($usr($1)) iecho Can't find $hc($1) on userlist, try $hc($usr($1)) instead.
  253.     else iecho Can't find $hc($1) on userlist.
  254.     return
  255.   }
  256.   if ($2 != $null) {
  257.     crypt 0 $lower($1) $2
  258.     writeini -n users.ini $1 botpass $result
  259.     if ($show) iecho Changed bot password for $hc($1)
  260.   }
  261.   else {
  262.     remini users.ini $1 botpass
  263.     if ($show) iecho Removed bot password for $hc($1)
  264.   }
  265. }
  266. chinfo {
  267.   if ($2 == $null) {
  268.     iecho Syntax: /chinfo <user> [channel] [infoline|none]
  269.     return
  270.   }
  271.   if ($usrhost($1) == $null) {
  272.     if ($usr($1)) iecho Can't find $hc($1) on userlist, try $hc($usr($1)) instead.
  273.     else iecho Can't find $hc($1) on userlist.
  274.     return
  275.   }
  276.   if (($findtok($usrchans($1),$2,1,44) == $null) && ($2 ischan)) addchan $1-2
  277.   if ($findtok($usrchans($1),$2,1,44)) {
  278.     if ($3- == none) {
  279.       remini users.ini $1 infoline. [ $+ [ $2 ] ]
  280.       if ($show) iecho Removed infoline for $hc($1) in $2
  281.     }
  282.     else {
  283.       writeini -n users.ini $1 infoline. [ $+ [ $2 ] ] $strip($3-)
  284.       if ($show) iecho Changed infoline for $hc($1) in $2 to " $+ $strip($3-) $+ "
  285.     }
  286.   }
  287.   elseif ($2- == none) {
  288.     remini users.ini $1 infoline
  289.     if ($show) iecho Removed infoline for $hc($1)
  290.   }
  291.   elseif ($2) {
  292.     writeini -n users.ini $1 infoline $strip($2-)
  293.     if ($show) iecho Changed infoline for $hc($1) to " $+ $strip($2-) $+ "
  294.   }
  295. }
  296. bans {
  297.   if ($ulist(*,20,0)) iecho Recorded bans:
  298.   else {
  299.     iecho No bans recorded.
  300.     return
  301.   }
  302.   set %i.bans 0
  303.   :start
  304.   inc %i.bans
  305.   if ($ulist(*,20,%i.bans)) {
  306.     echo -a [[ $+ $lfix(3,%i.bans) $+ ]] $ulist(*,20,%i.bans)
  307.     echo -a $fix(5,) $readini bans.ini $ulist(*,20,%i.bans) reason
  308.     echo -a $fix(5,) Channels: $readini bans.ini $ulist(*,20,%i.bans) channels
  309.     goto start
  310.   }
  311.   iecho End of banlist.
  312. }
  313. addban {
  314.   if ($1 == $null) {
  315.     iecho Syntax: /addban <hostmask> <channels> [reason]
  316.     return
  317.   }
  318.   if ($ulist($1,20,0)) {
  319.     iecho A ban matching $hc($1) already exists!
  320.     return
  321.   }
  322.   if ($2) set %banchans $2
  323.   else set %banchans $$?="Channels (enter 'all' for all chans)"
  324.   if ($3) set %reason $3-
  325.   else set %reason $?="Reason"
  326.   if (%reason == $null) set %reason request
  327.   if ($right($gettok(%reason,1,32),1) != :) set %reason $usr($me) $+ : %reason
  328.   writeini -n bans.ini $1 reason %reason
  329.   writeini -n bans.ini $1 channels %banchans
  330.   .auser 20 $1
  331.   .save -ru users.mrc
  332.   colupdt3 $1
  333.   if (%banchans == all) set %banchans $mychans
  334.   unset %tmp.addban
  335.   set %i.addban 0
  336.   :start
  337.   inc %i.addban
  338.   if ($gettok(%banchans,%i.addban,44)) {
  339.     if ($me isop $gettok(%banchans,%i.addban,44)) set %tmp.addban %tmp.addban $+ $crlf $+ mode $gettok(%banchans,%i.addban,44) b $1
  340.     goto start
  341.   }
  342.   if (%tmp.addban) .quote %tmp.addban
  343.   unset %reason %banchans
  344.   if ($show) iecho Shitlisted $hc($1) successfully.
  345. }
  346. remban {
  347.   if ($1 == $null) {
  348.     iecho Syntax: /remban <hostmask>
  349.     return
  350.   }
  351.   if ($ulist($1,20,1) == $null) {
  352.     iecho No such ban ( $+ $hc($1) $+ )
  353.     bans
  354.     return
  355.   }
  356.   remini bans.ini $ulist($1,20,1)
  357.   .timer 1 0 colupdt3 $ulist($1,20,1)
  358.   .ruser 20 $ulist($1,20,1)
  359.   .save -ru users.mrc
  360.   if ($show) iecho Ban on $hc($1) has been removed.
  361. }
  362. addhost {
  363.   if ($2 == $null) iecho Syntax: /addhost <username> <hostmask>
  364.   elseif ($usrhost($1) == $null) iecho Can't find $hc($1) on userlist.
  365.   elseif ($readini -n users.ini users $2 != $null) iecho That hostmask is already added for another user!
  366.   elseif ($findtok($hstmask($1),$2,1,32)) iecho Host $hc($2) already in hostmask list for $hc($1) $+ .
  367.   else {
  368.     .auser 40 $2
  369.     .save -ru users.mrc
  370.     writeini -n users.ini $1 hostmask $hstmask($1) $2
  371.     writeini -n users.ini Users $2 $1
  372.     colupdt3 $2
  373.     if ($show) iecho Added hostmask $hc($2) to $hc($1)) $+ .
  374.   }
  375. }
  376. remhost {
  377.   if ($2 == $null) iecho Syntax: /remhost <username> <hostmask>
  378.   elseif ($usrhost($1) == $null) iecho Can't find $hc($1) on userlist.
  379.   elseif ($findtok($hstmask($1),$2,1,32) == $null) iecho Host $hc($2) not in hostmask for $hc($1) $+ .
  380.   elseif ($hstmask($1) == $2) iecho Can not remove hostmask from $hc($1) $+ , no other hosts!
  381.   else {
  382.     .ruser 40 $2
  383.     .save -ru users.mrc
  384.     remini users.ini Users $2
  385.     writeini -n users.ini $1 hostmask $remtok($hstmask($1),$2,1,32)
  386.     colupdt3 $2
  387.     if ($show) iecho Removed hostmask $hc($2) from $hc($1) $+ .
  388.   }
  389. }
  390.